home *** CD-ROM | disk | FTP | other *** search
/ CD/PC Actual 76 / DVD Actual 1 Marzo 2003.iso / Trial / TurboCAD 7.1 Pro / Data.Cab / F24347_DlgProxy.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-11-10  |  2.9 KB  |  88 lines

  1. // DlgProxy.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "LTSample.h"
  6. #include "DlgProxy.h"
  7. #include "VpWnd.h"
  8. #include "LTSampleDlg.h"
  9.  
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CLTSampleDlgAutoProxy
  18.  
  19. IMPLEMENT_DYNCREATE(CLTSampleDlgAutoProxy, CCmdTarget)
  20.  
  21. CLTSampleDlgAutoProxy::CLTSampleDlgAutoProxy()
  22. {
  23.     EnableAutomation();
  24.     
  25.     // To keep the application running as long as an OLE automation 
  26.     //    object is active, the constructor calls AfxOleLockApp.
  27.     AfxOleLockApp();
  28.  
  29.     // Get access to the dialog through the application's
  30.     //  main window pointer.  Set the proxy's internal pointer
  31.     //  to point to the dialog, and set the dialog's back pointer to
  32.     //  this proxy.
  33.     ASSERT (AfxGetApp()->m_pMainWnd != NULL);
  34.     ASSERT_VALID (AfxGetApp()->m_pMainWnd);
  35.     ASSERT_KINDOF(CLTSampleDlg, AfxGetApp()->m_pMainWnd);
  36.     m_pDialog = (CLTSampleDlg*) AfxGetApp()->m_pMainWnd;
  37.     m_pDialog->m_pAutoProxy = this;
  38. }
  39.  
  40. CLTSampleDlgAutoProxy::~CLTSampleDlgAutoProxy()
  41. {
  42.     // To terminate the application when all objects created with
  43.     //     with OLE automation, the destructor calls AfxOleUnlockApp.
  44.     //  Among other things, this will destroy the main dialog
  45.     AfxOleUnlockApp();
  46. }
  47.  
  48. void CLTSampleDlgAutoProxy::OnFinalRelease()
  49. {
  50.     // When the last reference for an automation object is released
  51.     // OnFinalRelease is called.  The base class will automatically
  52.     // deletes the object.  Add additional cleanup required for your
  53.     // object before calling the base class.
  54.  
  55.     CCmdTarget::OnFinalRelease();
  56. }
  57.  
  58. BEGIN_MESSAGE_MAP(CLTSampleDlgAutoProxy, CCmdTarget)
  59.     //{{AFX_MSG_MAP(CLTSampleDlgAutoProxy)
  60.         // NOTE - the ClassWizard will add and remove mapping macros here.
  61.     //}}AFX_MSG_MAP
  62. END_MESSAGE_MAP()
  63.  
  64. BEGIN_DISPATCH_MAP(CLTSampleDlgAutoProxy, CCmdTarget)
  65.     //{{AFX_DISPATCH_MAP(CLTSampleDlgAutoProxy)
  66.         // NOTE - the ClassWizard will add and remove mapping macros here.
  67.     //}}AFX_DISPATCH_MAP
  68. END_DISPATCH_MAP()
  69.  
  70. // Note: we add support for IID_ILTSample to support typesafe binding
  71. //  from VBA.  This IID must match the GUID that is attached to the 
  72. //  dispinterface in the .ODL file.
  73.  
  74. // {31176189-A076-11D1-B79F-000021452DB6}
  75. static const IID IID_ILTSample =
  76. { 0x31176189, 0xa076, 0x11d1, { 0xb7, 0x9f, 0x0, 0x0, 0x21, 0x45, 0x2d, 0xb6 } };
  77.  
  78. BEGIN_INTERFACE_MAP(CLTSampleDlgAutoProxy, CCmdTarget)
  79.     INTERFACE_PART(CLTSampleDlgAutoProxy, IID_ILTSample, Dispatch)
  80. END_INTERFACE_MAP()
  81.  
  82. // The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project
  83. // {31176187-A076-11D1-B79F-000021452DB6}
  84. IMPLEMENT_OLECREATE2(CLTSampleDlgAutoProxy, "LTSample.Application", 0x31176187, 0xa076, 0x11d1, 0xb7, 0x9f, 0x0, 0x0, 0x21, 0x45, 0x2d, 0xb6)
  85.  
  86. /////////////////////////////////////////////////////////////////////////////
  87. // CLTSampleDlgAutoProxy message handlers
  88.